/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufscar.compiladores.ast;

import java.io.*;

public class Procedure extends Subroutine {

    public Procedure(String name) {
        this.name = name;
    }

    public void genC(PW pw) {
        pw.out.print("void " + name + "(");
        if (paramList != null) {
            paramList.genC(pw);
        }
        pw.out.println(") {");
        pw.add();
        if (!localVarList.isEmpty()) {
            for (VarDecList v : localVarList) {
                v.genC(pw);
            }
        }
        procBody.getCommandList().genC(pw);
        pw.sub();
        pw.out.println("}");
        pw.out.println();
        
    }
}